package de.baumann.browser.model

import de.baumann.browser.api.net.ExploreApiService
import de.baumann.browser.api.net.base.ApiBuilder
import de.baumann.browser.api.net.vo.ExploreMode
import de.baumann.browser.api.net.vo.explore.OdinDestroyBean
import de.baumann.browser.api.net.vo.explore.OdinDestroyMineTeamBean
import de.baumann.browser.api.net.vo.Result
import de.baumann.browser.api.net.vo.explore.OtherDestroyBean
import de.baumann.browser.rx.RxSchedulers
import io.reactivex.Observable

class ExploreApiMode {

    var exploreApiService: ExploreApiService = ApiBuilder.buildService(ExploreApiService::class.java)
    fun getExplore(): Observable<Result<ExploreMode>> {
        return exploreApiService.getExplore().compose(RxSchedulers.ioMain())
    }

    fun getExploreOdinDestroy(address: String, beginTime: String, endTime: String): Observable<Result<List<OdinDestroyBean>>> {
        return exploreApiService.getExploreOdinDestroy(address, beginTime, endTime).compose(RxSchedulers.ioMain())
    }

    fun getExploreOtherDestroy(address: String, beginTime: String, endTime: String): Observable<Result<List<OtherDestroyBean>>> {
        return exploreApiService.getExploreOtherDestroy(address, beginTime, endTime).compose(RxSchedulers.ioMain())
    }

    fun getExploreOdinSum(address: String, beginTime: String, endTime: String): Observable<Result<String>> {
        return exploreApiService.getExploreOdinSun(address, beginTime, endTime).compose(RxSchedulers.ioMain())
    }

    fun getExploreOtherSum(address: String, beginTime: String, endTime: String): Observable<Result<String>> {
        return exploreApiService.getExploreOtherSun(address, beginTime, endTime).compose(RxSchedulers.ioMain())
    }

    fun getExploreTeamOdinDestroy(): Observable<Result<List<OdinDestroyMineTeamBean>>> {
        return exploreApiService.getExploreTeamOdinDestroy().compose(RxSchedulers.ioMain())
    }

}